from pyexpat.errors import messages
# 人类：
# 属性:
# 姓名，性别，年龄，所拥有的手机剩余话费，手机品牌，手机电池容量，手机屏幕大小，手机最大待机时长，所拥有的积分。
# 功能：
# 发短信（要求参数传入短信内容）。
# 打电话（要求传入要打的电话号码和要打的时间长度。程序里判断号码是否为空或者本人的话费是否小于1元，若为空或者小于1元则报相对应的错误信息，
# 否则的话拨通。结束后，按照时间长度扣费并返回扣费并且按照分钟给手机卡累加积分（0~10分钟：1元/钟、15个积分/钟，10~20分钟：0.8元/钟、39个积分/钟，
# 其他：0.65元/钟、48个积分/钟））



class Person:
    def __init__(self, name, gender, age, phone_balance, brand, battery, screen_size, standby_time, points):
        self.name = name
        self.gender = gender
        self.age = age
        self.phone_balance = int(phone_balance)
        self.brand = brand
        self.battery = battery
        self.screen_size = screen_size
        self.standby_time = standby_time
        self.points = int(points)

    def send_message(self, number, message):

        return number, message




    def call(self, number, talk_time):
        count = 0
        if not number or int(self.phone_balance) < 1 :
            print("余额小于一元或拨打电话为空号")
        elif 0 < talk_time < 10 :
            self.phone_balance = self.phone_balance - talk_time
            self.points = self.points + (talk_time * 15)
            # print('通话结束')
            return talk_time, talk_time * 15
        elif 10 < talk_time < 20 :
            self.phone_balance = self.phone_balance - (talk_time * 0.8)
            self.points = self.points + (talk_time * 39)
            return talk_time*0.8, talk_time * 39
        else:
            self.phone_balance = self.phone_balance - (talk_time * 0.65)
            self.points = self.points + (talk_time * 48)
            return talk_time*0.65, talk_time * 48

x = Person("大傻","男", "22", "99", "苹果", "85", "6.9", "22hours", "50")
bill, score=x.call(555, 20)
m_number, mes = x.send_message('555','这是一条测试短信' )
print(f"您向{m_number}发送了一条短信，内容是{mes}")
print(f"通话结束，账单为{bill}元，增加{score}积分，话费余额为{x.phone_balance},积分为{x.points}")